from selenium.webdriver.common.by import By

from base import Base
class Page(Base):
    #用例1 搜索鸡蛋用例
    #搜索框1
    def kuang1(self):
        #使用XPATH定位方式
        loc=(By.XPATH,'//android.widget.TextView[@text="搜索菜谱"]')
        ele=self.find_ele(loc)
        return ele

    #搜索框2
    def kuang2(self):
        #使用CLASS_NAME定位方式
        loc=(By.CLASS_NAME,'android.widget.EditText')
        ele=self.find_ele(loc)
        return ele
    #搜索按钮
    def anniu(self):
        #使用android uiautomator定位方式
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().text("搜索")')
        ele=self.find_ele(loc)
        return ele
    #返回按钮
    def fanhui(self):
        #使用accessibility id定位方式
        loc=(By.ACCESSIBILITY_ID,'返回')
    #用例2 点赞广式月饼用例
    #关注界面按钮
    def guanzhu(self):
        loc=(By.XPATH,'//android.widget.TextView[@resource-id="android:id/text1" and @text="关注"]')
        ele=self.find_ele(loc)
        return ele
    #点赞按钮
    def dianzan(self):
        loc=(By.ID,'com.xiachufang:id/common_control_panel_digg_btn_drawable')
        ele=self.find_ele(loc)
        return ele
    #用例3 评论广式月饼用例
    #评论按钮
    def pinglun(self):
        loc=(By.ID,'com.xiachufang:id/common_control_panel_comment_btn_drawable')
        ele=self.find_ele(loc)
        return ele
    #评论框
    def kuang3(self):
        loc=(By.ID,'com.xiachufang:id/eidt_comment_content')
        ele=self.find_ele(loc)
        return ele

    #发送按钮
    def fasong(self):
        loc=(By.ID,'com.xiachufang:id/tv_comment_publish_btn')
        ele=self.find_ele(loc)
        return ele

